/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

function validate(id, regex, min, max, result, path) {
    //Get what's validated
    var Validated = document.getElementById(id);
    //Check
    if (Validated.value.length < min)
        document.getElementById(result).innerHTML = '<img src="'+path+'images/Cross.png" alt="">';
    else if (max > -1 && Validated.value.length > max)
        document.getElementById(result).innerHTML = '<img src="'+path+'images/Cross.png" alt="">';
    else if (!regex.test(Validated.value))
        document.getElementById(result).innerHTML = '<img src="'+path+'images/Cross.png" alt="">';
    else 
        document.getElementById(result).innerHTML = '<img src="'+path+'images/Check.png" alt="">';
}

function confirmPassword(text1, text2, result, path) {
    //Check
    if (document.getElementById(text1).value == document.getElementById(text2).value)
        //document.getElementById(result).innerHTML = "";
        document.getElementById(result).innerHTML = '<img src="'+path+'images/Check.png" alt="">';
    else	document.getElementById(result).innerHTML = '<img src="'+path+'images/Cross.png" alt="">';
    return;
}

function validateform(name,pass,confirm,email,path){
    var valid = '<img src="'+path+'images/Check.png" alt="">';
    if(document.getElementById(name).innerHTML == valid &&
        document.getElementById(pass).innerHTML == valid &&
        document.getElementById(confirm).innerHTML == valid &&
        document.getElementById(email).innerHTML == valid &&
        document.form_register.date.value != ""
            )
        return true;
    else
    {
        alert("Complete your data with valid input");
        return false;
    }
}